App.Ui = (function(U){

	U.loading = function(args){

		var opts = {
			msg: '',
			opacity: 0.4
		}

		_.extend(opts, args)

		var $loading = ($('#loading').length > 0) ? $('#loading') : $('<div id="loading"><p><img src="./img/loading.png" alt="loading"><span>' + opts.msg + '<span></p></div>').prependTo('body');

		$loading.css({
			opacity: opts.opacity,
			visibility: 'visible',
			zIndex: 999
		})

		$loading.bind("touchstart", function(e) {
			e.preventDefault();
		}).bind("touchmove", function(e) {
			e.preventDefault();
		});
	}

	U.loading.close = function(){
		var $loading = $('#loading');
		$loading.css({
			visibility: 'hidden'
		})

		$loading.unbind("touchstart").unbind("touchmove")
	}

	return U;

})(App.Ui || {})